package com.tyk.bookstore.back.logistics.util;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.tyk.bookstore.back.logistics.manager.excel.model.ExpressCompanyExcelVo;
import com.tyk.bookstore.back.logistics.manager.excel.model.WaybillExcelVo;
import com.tyk.bookstore.back.logistics.model.entity.ExpressCompanyDo;
import com.tyk.bookstore.back.logistics.model.entity.WaybillDo;
import com.tyk.bookstore.back.logistics.model.query.ExpressCompanyAddQuery;
import com.tyk.bookstore.back.logistics.model.query.ExpressCompanyUpdateQuery;
import com.tyk.bookstore.back.logistics.model.query.WayBill4OrderAddQuery;
import com.tyk.bookstore.back.logistics.model.vo.ExpressCompanyPageVo;
import com.tyk.bookstore.back.logistics.model.vo.ExpressCompanyVo;
import com.tyk.bookstore.back.logistics.model.vo.WaybillPageVo;
import com.tyk.bookstore.back.logistics.model.vo.WaybillVo;
import com.tyk.bookstore.back.storage.model.dto.Warehouse4WaybillDto;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

import java.util.List;

@Mapper(componentModel = "spring")
public interface MapStructLogistics {
    ExpressCompanyVo toExpressCompanyVo(ExpressCompanyDo expressCompany);

    ExpressCompanyPageVo toExpressCompanyPageVo(Page<ExpressCompanyDo> page);


    @Mappings({
            @Mapping(target = "id", ignore = true),
            @Mapping(target = "createTime", ignore = true),
            @Mapping(target = "updateTime", ignore = true)
    })
    ExpressCompanyDo toExpressCompanyDo(ExpressCompanyAddQuery query);


    @Mappings({
            @Mapping(target = "createTime", ignore = true),
            @Mapping(target = "updateTime", ignore = true)
    })
    ExpressCompanyDo toExpressCompanyDo(ExpressCompanyUpdateQuery query);


    @Mappings({
            @Mapping(target = "memberId", ignore = true),
            @Mapping(target = "warehouseName", ignore = true),
            @Mapping(target = "expressCompanyName", ignore = true)
    })
    WaybillVo toWaybillVo(WaybillDo waybill);

    WaybillPageVo toWaybillPageVo(Page<WaybillDo> page);


    @Mappings({
            @Mapping(target = "memberId", ignore = true),
            @Mapping(target = "warehouseName", ignore = true),
            @Mapping(target = "expressCompanyName", ignore = true)
    })
    WaybillPageVo.Waybill toWaybillPageVo$Waybill(WaybillDo waybillDo);


    @Mappings({
            @Mapping(target = "id", ignore = true),
            @Mapping(target = "trackingNo", ignore = true),
            @Mapping(target = "weight", ignore = true),
            @Mapping(target = "freight", ignore = true),
            @Mapping(target = "state", ignore = true),
            @Mapping(target = "updateTime", ignore = true),
            @Mapping(target = "createTime", ignore = true)
    })
    WaybillDo toWaybillDo(WayBill4OrderAddQuery query, Warehouse4WaybillDto waybillDto);

    List<ExpressCompanyExcelVo> toExpressCompanyExcelVoList(List<ExpressCompanyDo> doList);

    List<ExpressCompanyDo> toExpressCompanyDoList(List<ExpressCompanyExcelVo> expressCompanyList);

    @Mappings({
            @Mapping(target = "id", ignore = true),
            @Mapping(target = "createTime", ignore = true),
            @Mapping(target = "updateTime", ignore = true),
    })
    ExpressCompanyDo toExpressCompany(ExpressCompanyExcelVo expressCompany);

    List<WaybillExcelVo> toWaybillExcelVoList(List<WaybillDo> doList);
}
